Fix for bug#259#260
Conversation
**Root cause** The client constructor relies on the `getUser` method of the `miscRequests` module, which requires location-specific URL to be passed as one of its arguments. Added a property `location` to the `clientOptions` object passed to the client constructor. This `location` field will then be passed to the `getUser` method within the constructor.
|
Will it be possible to expedite the review for this PR? I have a project that is waiting on this fix, and it would be highly appreciated if the fix was made available as soon as possible. @Mathieu2301 |
|
@narayanan-gokul thanks for the PR. can you share your requests and responses for both with the location option and without? kind of hard to approve without seeing some kind of testing |
|
@clins1994 Definitely! My bad for not adding evidence sooner. Here's a basic client initialization code: const client = new Client({ token: sessionid, signature });Using this code to create a client using valid session cookies for an account based in India throws the following error: Adding the option to pass the location-specific URL changes the client code like so: const client = new Client({ token: sessionid, signature, location: "https://in.tradingview.com" });Which produces no error: Please let me know in case you need anything else. |
|
@narayanan-gokul no worries. thank you for providing the info. looks good ✅ |
|
@clins1994 Thank you for the review! |


Fix for #259
Root cause
The client constructor relies on the
getUsermethod of themiscRequestsmodule, which requires location-specific URL to be passed as one of its arguments.Added a property
locationto theclientOptionsobject passed to the client constructor. Thislocationfield will then be passed to thegetUsermethod within the constructor.